package com.blog.study.study7;

/**
 * 平常使用的线程
 *
 * @author 15127
 * @time 2017/12/2 21:31
 */
public class NormalThread {

    public static void main(String[] args) {
        Thread thread = new Thread("一号线程") {
            @Override
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(Thread.currentThread() + ":RUN");
                }
            }
        };

        thread.start();


        Thread thread1 = new Thread(() -> {
            while (true){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName());
            }
        });

        thread1.start();
    }

}
